package com.zret.oasys.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Leavetable {

	private String leavenum;// 流水号
	private int empid;// 员工id
	private Date starttime;// 请假开始时间
	private String leavecomment;// 请假事由
	private Date endtime;// 请假结束时间
	private String leavetype;// 请假类型
	private String apptype;// 审批状态
	private String comment;// 审批意见
	//增加一个大类 (审批表关联, 后期可以是list)
	private Leavedetails leavedetails;
	//增加一个大类 (审批的经理名, 暂时的)
	private Emp emp;
	//增加另一个员工类(提交这个请假表的员工)
	private Emp selfEmp;
	// 日期格式化
	private static SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	/**
	 * 无参构造
	 */
	public Leavetable() {
		// TODO Auto-generated constructor stub
	}
	
    /**
     * 有参构造
     * @param leavenum 流水号
     * @param empid 员工id
     * @param starttime 请假开始时间
     * @param leavecomment 请假事由
     * @param endtime 请假结束时间
     * @param leavetype 请假类型
     * @param apptype 审批状态
     * @param comment 审批意见
     */
	public Leavetable(String leavenum, int empid, Date starttime, String leavecomment, Date endtime, String leavetype,
			String apptype, String comment) {
		super();
		this.leavenum = leavenum;
		this.empid = empid;
		this.setStarttime(starttime);
		this.leavecomment = leavecomment;
		this.setEndtime(endtime);
		this.leavetype = leavetype;
		this.apptype = apptype;
		this.comment = comment;
	}
	
	 /**
     * 有参构造
     * @param leavenum 流水号
     * @param empid 员工id
     * @param starttime 请假开始时间
     * @param leavecomment 请假事由
     * @param endtime 请假结束时间
     * @param leavetype 请假类型
     * @param apptype 审批状态
     * @param comment 审批意见
     */
	public Leavetable(String leavenum, int empid, String starttime, String leavecomment, String endtime, String leavetype,
			String apptype, String comment) {
		super();
		this.leavenum = leavenum;
		this.empid = empid;
		this.setStarttime(starttime);
		this.leavecomment = leavecomment;
		this.setEndtime(endtime);
		this.leavetype = leavetype;
		this.apptype = apptype;
		this.comment = comment;
	}

	  /**
     * 有参构造
     * @param empid 员工id
     * @param starttime 请假开始时间
     * @param leavecomment 请假事由
     * @param endtime 请假结束时间
     * @param leavetype 请假类型
     * @param apptype 审批状态
     * @param comment 审批意见
     */
	public Leavetable(int empid, String starttime, String leavecomment, String endtime, String leavetype,
			String apptype, String comment) {
		super();
		this.empid = empid;
		this.setStarttime(starttime);
		this.leavecomment = leavecomment;
		this.setEndtime(endtime);
		this.leavetype = leavetype;
		this.apptype = apptype;
		this.comment = comment;
	}
	
   /**
    * 有参构造
    * @param empid  员工id
    * @param starttime 请假开始时间
    * @param endtime 请假结束时间
    */
	public Leavetable(int empid, Date starttime, Date endtime) {
		super();
		this.empid = empid;
		this.setStarttime(starttime);;
		this.setEndtime(endtime);;
	}


	public String getLeavenum() {
		return leavenum;
	}

	public void setLeavenum(String leavenum) {
		this.leavenum = leavenum;
	}

	public int getEmpid() {
		return empid;
	}

	public void setEmpid(int empid) {
		this.empid = empid;
	}

	/**
	 * 获取开始字符串时间
	 * @return
	 */
	public String getStarttime() {
		return simple.format(starttime);
	}
	
    /**
     * 设置开始时间
     * @param starttime
     */
	public void setStarttime(Date starttime) {
		this.starttime = starttime;
	}
	
	/**
	 * 设置开始时间
	 * @param starttime
	 */
	public void setStarttime(String starttime) {
		try {
			this.starttime = simple.parse(starttime);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	

	public String getLeavecomment() {
		return leavecomment;
	}

	public void setLeavecomment(String leavecomment) {
		this.leavecomment = leavecomment;
	}

	/**
	 * 获取字符串结束时间
	 * @return
	 */
	public String getEndtime() {
		return simple.format(endtime);
	}

	public void setEndtime(Date endtime) {
		this.endtime = endtime;
	}
	
    /**
     * 设置字符串结束时间	
     * @param endtime
     */
	public void setEndtime(String endtime) {
		try {
			this.endtime = simple.parse(endtime);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	

	public String getLeavetype() {
		return leavetype;
	}

	public void setLeavetype(String leavetype) {
		this.leavetype = leavetype;
	}

	public String getApptype() {
		return apptype;
	}

	public void setApptype(String apptype) {
		this.apptype = apptype;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
	
	public Leavedetails getLeavedetails() {
		return leavedetails;
	}

	public void setLeavedetails(Leavedetails leavedetails) {
		this.leavedetails = leavedetails;
	}

	public Emp getEmp() {
		return emp;
	}

	public void setEmp(Emp emp) {
		this.emp = emp;
	}
	
	public Emp getSelfEmp() {
		return selfEmp;
	}

	public void setSelfEmp(Emp selfEmp) {
		this.selfEmp = selfEmp;
	}

	@Override
	public String toString() {
		return "Leavetable [leavenum=" + leavenum + ", empid=" + empid + ", starttime=" + starttime + ", leavecomment="
				+ leavecomment + ", endtime=" + endtime + ", leavetype=" + leavetype + ", apptype=" + apptype
				+ ", comment=" + comment + "]";
	}

	

	

}
